package StudyCode.summary.mycollection;

import java.util.ArrayList;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReplaceAnElementAtSpecifiedIndexOfArrayList {
	public static void main(String[] args) {
		ArrayList<String> arrayList = new ArrayList<>();
		arrayList.add("1");
		arrayList.add("2");
		arrayList.add("3");

		System.out.println("替换前:");
		for (String s : arrayList) {
			System.out.println(s);
		}

		arrayList.set(1, "REPLACED ELEMENT");
		System.out.println("替换后:");
		for (String s : arrayList) {
			System.out.println(s);
		}
	}
}
